const mongoose = require('mongoose');

const AdminTodoSchema = new mongoose.Schema({
  todoId: {
    type: String,
    required: true,
    unique: true
  },
  title: {
    type: String,
    required: true
  },
  content: {
    type: String,
    required: true
  },
  priority: {
    type: Number,
    enum: [1, 2, 3], // 1: 高, 2: 中, 3: 低
    default: 2
  },
  status: {
    type: Number,
    enum: [0, 1, 2], // 0: 待办, 1: 进行中, 2: 已完成
    default: 0
  },
  creatorId: {
    type: String,
    required: true
  },
  assigneeId: {
    type: String
  },
  dueDate: {
    type: Date
  },
  flag: {
    type: Boolean,
    default: true
  },
  createTime: {
    type: Date,
    default: Date.now
  },
  updateTime: {
    type: Date,
    default: Date.now
  }
});

module.exports = mongoose.model('AdminTodo', AdminTodoSchema);